package com.tsvetanv.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.tsvetanv.service.NewsService;

public class NewsPageController extends AbstractController {
	private NewsService newsService;

	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		ModelAndView modelAndView = new ModelAndView("newsSpot");
		modelAndView.addObject("msg",
				"Be in touch with the news of our application");
		modelAndView.addObject("newsList", newsService.getNews());
		return modelAndView;
	}

	public void setNewsService(NewsService newsService) {
		this.newsService = newsService;
	}

}
